\section{Source/TopDownView.h}


\begin{footnotesize}\begin{alltt}
00001 \textcolor{preprocessor}{#ifndef TOP\_DOWN\_VIEW\_HEADER}
00002 \textcolor{preprocessor}{}\textcolor{preprocessor}{#define TOP\_DOWN\_VIEW\_HEADER}
00003 \textcolor{preprocessor}{}
00004 \textcolor{comment}{/*}
00005 \textcolor{comment}{    TODO:}
00006 \textcolor{comment}{        Add a function which allows loading of avatar images }
00007 \textcolor{comment}{            via SDL\_Surface *'s.}
00008 \textcolor{comment}{*/}
00009 \textcolor{preprocessor}{#include <SDL/SDL.h>}
00010 \textcolor{preprocessor}{#include <SDL/SDL\_image.h>}
00011 \textcolor{preprocessor}{#include <stdlib.h>}
00012 
00013 \textcolor{keyword}{extern} \textcolor{keywordtype}{int} TileWidth, TileHeight, AreaWidth, AreaHeight, MapHeight, MapWidth;
00014 \textcolor{keyword}{extern} \textcolor{keywordtype}{int} AvatarX, AvatarY;
00015 
00016 \textcolor{comment}{/* The interface functions: */}
00017 
00018 \textcolor{comment}{/* }
00019 \textcolor{comment}{    This function must be callled before any other function, or it will}
00020 \textcolor{comment}{    probably cause a segmentation fault}
00021 \textcolor{comment}{    }
00022 \textcolor{comment}{    Param `Width':}
00023 \textcolor{comment}{        The width of the area that the TopDownView will control}
00024 \textcolor{comment}{    Param `Height':}
00025 \textcolor{comment}{        The height of the area that the TopDownView will control}
00026 \textcolor{comment}{    Param `Display':}
00027 \textcolor{comment}{        The area that the TopDownView will control}
00028 \textcolor{comment}{    }
00029 \textcolor{comment}{    Return:}
00030 \textcolor{comment}{        This function will return -1 if a failure, else 0}
00031 \textcolor{comment}{*/}
00032 \textcolor{keywordtype}{int} TDV\_InitTopDownView(\textcolor{keywordtype}{int} Width, \textcolor{keywordtype}{int} Height, SDL\_Surface *Display);
00033 \textcolor{comment}{/* }
00034 \textcolor{comment}{    This function sets a tile to an image }
00035 \textcolor{comment}{    Param `Reference':}
00036 \textcolor{comment}{        The number that will reference that specific tile in the map}
00037 \textcolor{comment}{    Param `Filename':}
00038 \textcolor{comment}{        The filename that will be passed to the image handling function}
00039 \textcolor{comment}{    }
00040 \textcolor{comment}{    Return:}
00041 \textcolor{comment}{        This function will return the reference if everything went fine, }
00042 \textcolor{comment}{        else it will return -1 and it can be handled accordingly}
00043 \textcolor{comment}{    }
00044 \textcolor{comment}{    Note:}
00045 \textcolor{comment}{        If the tile with reference `Reference' already exists, then it will be ov
      erwritten}
00046 \textcolor{comment}{*/}
00047 \textcolor{keywordtype}{int} TDV\_SetTileFromFile(\textcolor{keywordtype}{int} Reference, \textcolor{keywordtype}{char} *Filename);
00048 \textcolor{comment}{/*}
00049 \textcolor{comment}{    This function sets a tile to a surface}
00050 \textcolor{comment}{    Param `Reference':}
00051 \textcolor{comment}{        The number that will reference that specific tile in the map}
00052 \textcolor{comment}{    Param `Surface':}
00053 \textcolor{comment}{        The surface that the tile will be using }
00054 \textcolor{comment}{}
00055 \textcolor{comment}{    Return: }
00056 \textcolor{comment}{        This function will return -1 on error, else Reference}
00057 \textcolor{comment}{}
00058 \textcolor{comment}{    Note:}
00059 \textcolor{comment}{        If the tile with reference `Reference' already exists, it will be overwri
      tten}
00060 \textcolor{comment}{*/}
00061 \textcolor{keywordtype}{int} SetTileFromSurface(\textcolor{keywordtype}{int} Reference, SDL\_Surface *Surface);
00062 \textcolor{comment}{/*}
00063 \textcolor{comment}{    TODO:}
00064 \textcolor{comment}{        Document this function}
00065 \textcolor{comment}{*/}
00066 \textcolor{keywordtype}{int} TDV\_SetAvatarImage(SDL\_Surface *Image);
00067 
00068 \textcolor{comment}{/* Setters, pretty self explanatory */}
00069 \textcolor{keywordtype}{void} TDV\_SetMap(\textcolor{keywordtype}{int} *Map);
00070 \textcolor{keywordtype}{void} TDV\_SetTileWidth(\textcolor{keywordtype}{int} Width);
00071 \textcolor{keywordtype}{void} TDV\_SetTileHeight(\textcolor{keywordtype}{int} Height);
00072 \textcolor{keywordtype}{void} TDV\_SetTileDimensions(\textcolor{keywordtype}{int} Width, \textcolor{keywordtype}{int} Height);
00073 \textcolor{keywordtype}{void} TDV\_ChangeAreaWidth(\textcolor{keywordtype}{int} Width);
00074 \textcolor{keywordtype}{void} TDV\_ChangeAreaHeight(\textcolor{keywordtype}{int} Height);
00075 \textcolor{keywordtype}{void} TDV\_ChangeAreaDimensions(\textcolor{keywordtype}{int} Width, \textcolor{keywordtype}{int} Height);
00076 \textcolor{keywordtype}{void} TDV\_SetAvatarX(\textcolor{keywordtype}{int} X);
00077 \textcolor{keywordtype}{void} TDV\_SetAvatarY(\textcolor{keywordtype}{int} Y);
00078 \textcolor{keywordtype}{void} TDV\_SetAvatarPosition(\textcolor{keywordtype}{int} X, \textcolor{keywordtype}{int} Y);
00079 \textcolor{keywordtype}{void} TDV\_SetMapWidth(\textcolor{keywordtype}{int} Width);
00080 \textcolor{keywordtype}{void} TDV\_SetMapHeight(\textcolor{keywordtype}{int} Height);
00081 \textcolor{keywordtype}{void} TDV\_SetMapDimensions(\textcolor{keywordtype}{int} Width, \textcolor{keywordtype}{int} Height);
00082 \textcolor{comment}{/* Getters, also quite explanatory */}
00083 \textcolor{keywordtype}{int} TDV\_GetTileWidth();
00084 \textcolor{keywordtype}{int} TDV\_GetTileHeight();
00085 \textcolor{keywordtype}{int} TDV\_GetAreaWidth();
00086 \textcolor{keywordtype}{int} TDV\_GetAreaHeight();
00087 \textcolor{keywordtype}{int} TDV\_GetAvatarX();
00088 \textcolor{keywordtype}{int} TDV\_GetAvatarY();
00089 \textcolor{keywordtype}{int} TDV\_GetMapWidth();
00090 \textcolor{keywordtype}{int} TDV\_GetMapHeight();
00091 \textcolor{comment}{/*}
00092 \textcolor{comment}{    This function plots all of the viewable tiles onto the area allocated }
00093 \textcolor{comment}{    Note:}
00094 \textcolor{comment}{        The changes will not be presented to the user until the application calls
       SDL\_Flip(); on the screen}
00095 \textcolor{comment}{*/}
00096 \textcolor{keywordtype}{void} TDV\_DrawToArea();
00097 \textcolor{keywordtype}{void} TDV\_DrawAvatar();
00098 \textcolor{comment}{/* The internal functions:*/}
00099 SDL\_Surface *TDV\_I\_GetTileAt(\textcolor{keywordtype}{int} X, \textcolor{keywordtype}{int} Y);
00100 
00101 \textcolor{preprocessor}{#endif}
\end{alltt}\end{footnotesize}
